ccR.Target = {
	Can = { Attack = function(unit) return ccR.Target.CanAttack(unit) end },
	CanAttack = function(unit) return ccR.Unit.Is.Attackable("target", unit) end,
	Class = function() return ccR.Unit.Class("target") end,
	Count = function(yards) return ccR.Unit.Count("target", yards) end,
	Distance =
	function(raw) 
		if ccR.Target.Exists() then 
			if raw ~= nil then
				return ccR.Unit.Distance("target", "player", true)
			else
				return ccR.Unit.Distance("target", "player")
			end
		else
			return 999999999999
		end
	end,
	Exists = function() return ccR.Unit.Exists("target") end,
	GUID = function() if ccR.Target.Exists() then return ccR.Unit.GUID("target") end end,
	Health = function(sort) return ccR.Unit.Health("target", sort) end,
	Level = function() return ccR.Unit.Level("target") end,
	Mana = function(sort) return ccR.Unit.Mana("target", sort) end,
	Name = function() return ccR.Unit.Name("target") end,
	NPCID = function() return ccR.Unit.NPCID("target") end,
	Race = function() return ccR.Unit.Race("target") end,
	Realm = function() return ccR.Unit.Realm("target") end,
	TargetName = function() return ccR.Unit.TargetName("tarsget") end,
	TimeToDie = function() return ccR.Unit.TimeToDie("target") end,
	Aura = {
		Duration = function(aura, by, number) return ccR.Unit.Aura.Duration("target", aura, by, number) end,
		Exists = function(aura) return ccR.Unit.Aura.Exists("target", aura) end,
		Stacks = function(aura) return ccR.Unit.Aura.Stacks("target", aura) end,
	},
	Buff = {
		Duration = function(buff, by, number) return ccR.Unit.Buff.Duration("target", buff, by, number) end,
		Exists = function(buff) return ccR.Unit.Buff.Exists("target", buff) end,
		Stacks = function(buff) return ccR.Unit.Buff.Stacks("target", buff) end,
	},
	Debuff = {
		Duration = function(debuff, by, number) return ccR.Unit.Debuff.Duration("target", debuff, by, number) end,
		Exists = function(debuff) return ccR.Unit.Debuff.Exists("target", debuff) end,
		Stacks = function(debuff) return ccR.Unit.Debuff.Stacks("target", debuff) end,
	},
	Has = {
		Aura = function(aura) return ccR.Unit.Has.Aura("target", aura) end,
		Buff = function(buff) return ccR.Unit.Buff.Exists("target", buff) end,
		CC = function() return ccR.Unit.Has.CC("target") end,
		Debuff = function(debuff) return ccR.Unit.Debuff.Exists("target", debuff) end,

		LeftOnCast = function(time) return ccR.Unit.Has.LeftOnCast("target", time) end,
		LeftOnChannel = function(time) return ccR.Unit.Has.LeftOnChannel("target", time) end,
		My = {
			Aura = function(aura) return ccR.Unit.Aura.Exists("target", aura, true) end,
			Buff = function(buff) return ccR.Unit.Buff.Exists("target", buff, true) end,
			Debuff = function(debuff) return ccR.Unit.Debuff.Exists("target", debuff, true) end,
			AuraDuration = function(aura, by, number) return ccR.Unit.Aura.Duration("target", aura, by, number, true) end,
			BuffDuration = function(buff, by, number) return ccR.Unit.Buff.Duration("target", buff, by, number, true) end,
			DebuffDuration = function(debuff, by, number) return ccR.Unit.Debuff.Duration("target", debuff, by, number, true) end,
			AuraStacks = function(aura) return ccR.Unit.Aura.Stacks("target", true) end,
			BuffStacks = function(buff) return ccR.Unit.Buff.Stacks("target", true) end,
			DebuffStacks = function(debuff) return ccR.Unit.Debuff.Stacks("target", true) end,

		},
		MyBuff = function(buff) return ccR.Target.Has.My.Buff(buff) end,
		MyDebuff = function(debuff) return ccR.Target.Has.My.Debuff(debuff) end,
		Target = function() return ccR.Unit.Has.Target("target") end,
	},
	Is = {
		Alive = function() return ccR.Unit.Is.Alive("target") end,
		APlayer = function() return ccR.Unit.Is.APlayer("target") end,
		Attackable = function() return ccR.Unit.Is.Attackable("player", "target") end,
		Boss = function() return ccR.Unit.Is.Boss("target") end,
		Casting = function() return ccR.Unit.Is.Casting("target") end,
		CastingAtPlayer = function() return ccR.Unit.Is.CastingAtPlayer("target") end,
		CastingSpell = function(spell) return ccR.Unit.Is.CastingSpell("target", spell) end,
		CastingOrChanneling = function() if ccR.Unit.Is.Casting("target") or ccR.Unit.Is.Channeling("target") then return true else return false end end,
		CastingOrChannelingAtPlayer = function() return ccR.Unit.Is.CastingOrChannelingAtPlayer("target") end,
		CC = function() return ccR.Unit.Is.CC("target") end,
		Channeling = function() return ccR.Unit.Is.Channeling("target") end,
		ChannelingSpell = function(spell) return ccR.Unit.Is.ChannelingSpell("target", spell) end,
		ChannelingAtPlayer = function() return ccR.Unit.Is.ChannelingAtPlayer("target") end,
		Dead = function() return ccR.Unit.Is.Dead("target") end,
		DPS = function() return ccR.Unit.Is.DPS("target") end,
		Dummy = function() return ccR.Unit.Is.Dummy("target") end,
		Elite = function() return ccR.Unit.Is.Elite("target") end,
		ExactFacing = function(unit) return ccR.Unit.Is.ExactFacing("target", unit)	end,
		EnemyPlayer = function() return ccR.Unit.Is.EnemyPlayer("target") end,
		Facing = function(unit) if ccR.Unit.Exists(unit) then return ccR.Unit.Is.Facing("target", unit) end end,
		Frozen = function() return ccR.Unit.Is.Frozen("target") end,
		Ghost = function() return UnitIsGhost("target") end,
		Healer = function() return ccR.Unit.Is.Healer("target") end,
		Interuptable = function() return ccR.Unit.Is.Interuptable("target") end,
		In = {
			Combat = function() return ccR.Target.Is.InCombat() end,
			LineOfSight = function() return ccR.Target.Is.InLineOfSight() end,
		},
		InCombat = function() return ccR.Unit.Is.InCombat("target") end,
		InLineOfSight = function() return ccR.Unit.Is.InLineOfSight("target") end,
		Moving = function() return ccR.Unit.Is.Moving("target") end,
		Normal = function() return ccR.Unit.Is.Normal("target") end,
		Rare = function(unit) return ccR.Unit.Is.Rare("target") end,
		Tapped = function() return ccR.Unit.Is.Tapped("target") end,
		TappedByPlayer = function() return ccR.Unit.Is.TappedByPlayer("target") end,
		TargetingPlayer = function() return ccR.Unit.Is.TargetingPlayer("target") end,
		Tank = function() return ccR.Unit.Is.Tank("target") end,
		Visible = function() return ccR.Unit.Is.Visible("target") end,
		VisibleOnScreen = function() return ccR.Unit.Is.VisibleOnScreen("target") end,
	},
	---------
	-- OLD --
	---------
		BuffStacks = function(buff) return ccR.Target.Buff.Stacks(buff) end,
		DebuffStacks = function(debuff) return ccR.Target.Debuff.Stacks(buff) end,
		BuffDuration = function(buff, by, number) return ccR.Target.Buff.Duration(buff, by, number) end,
		DebuffDuration = function(debuff, by, number) return ccR.Target.Debuff.Duration(debuff, by, number) end,
		MyBuffDuration = function(buff, by, number) return ccR.Target.Has.My.BuffDuration(buff, by, number) end,
		MyDebuffDuration = function(debuff, by, number) return ccR.Target.Has.My.DebuffDuration(debuff, by, number) end,
		HasBuff = function(buff) return ccR.Target.Has.Buff(buff) end,
		HasDebuff = function(debuff) return ccR.Target.Has.Debuff(debuff) end,
		HasLeftOnCast = function(time) return ccR.Target.Has.LeftOnCast(time) end,
		HasLeftOnChannel = function(time) return ccR.Target.Has.LeftOnChannel(time) end,
		HasMyBuff = function(buff) return ccR.Target.Has.MyBuff(buff) end,
		HasMyDebuff = function(debuff) return ccR.Target.Has.MyDebuff(debuff) end,
		HasTarget = function() return ccR.Target.Has.Target() end,
		IsAlive = function() return ccR.Target.Is.Alive() end,
		IsAttackable = function() return ccR.Target.Is.Attackable() end,
		IsBoss = function() return ccR.Target.Is.Boss() end,
		IsCasting = function() return ccR.Target.Is.Casting() end,
		IsCastingSpell = function(spell) return ccR.Target.Is.CastingSpell(spell) end,
		IsCastingOrChanneling = function() return ccR.Target.Is.CastingOrChanneling() end,
		IsChanneling = function() return ccR.Target.Is.Channeling() end,
		IsChannelingSpell = function(spell) return ccR.Target.Is.ChannelingSpell("target", spell) end,
		IsDead = function() return ccR.Target.Is.Dead() end,
		IsFacing = function(unit) return ccR.Target.Is.Facing(unit) end,
		IsDPS = function() return ccR.Target.Is.DPS() end,
		IsGhost = function() return ccR.Target.Is.Ghost() end,
		IsHealer = function() return ccR.Target.Is.Healer() end,
		IsInteruptable = function() return ccR.Target.Is.Interuptable() end,
		IsInCombat = function() return ccR.Target.Is.InCombat() end,
		IsInLineOfSight = function() return ccR.Target.Is.InLineOfSight() end,
		IsMoving = function() return ccR.Target.Is.Moving() end,
		IsTank = function() return ccR.Target.Is.Tank() end,
		IsTapped = function() return ccR.Target.Is.Tapped() end,
		IsTappedByPlayer = function() return ccR.Target.Is.TappedByPlayer() end,
		IsTargetingPlayer = function() return ccR.Target.Is.TargetingPlayer() end,
}

setmetatable(ccR.Target, ccR.Unit)